<div class="container" id="ajax_content">
    <?php
        include 'header2.php';
    ?>
    <div class="content">
    	<div class="headcontent">
        <span class="randomtext" style="margin-left:50px">Hi, 
        <?php
            global $session;
            $user_id = $session->get('userid');
            $sql="SELECT fullname FROM user WHERE iduser='$user_id'";
            $result=mysql_query($sql);
            while($res = mysql_fetch_array($result)) {
                $nama = $res['fullname'];
            }
            echo $nama;
        ?>
        </span>
        <span class="randomtext" style="padding-left:900px">PHOTO DETAIL</span>
        <hr/>
        </div>
        <div class="leftcontent" style="width: 380px; margin-left: 50px">
            <div class="randomtext" style="margin-bottom: 10px; margin-top: 15px">Photo Information</div>
            <div class="item2">
                <label>File Name :</label><br/>
                <label style="text-align:left"><?php echo $p;?></label>
            </div>
            <div class="item2">
                <label>Category :</label><br/>
                <label style="text-align:left"><?php if ($p1 == '1') {echo "Kategori 1";} else if ($p1 == '2') {echo "Kategori 2";} else {echo "Kategori 3";};?></label>
            </div>
            <div class="item2">
                <label>Description :</label><br/>
                <label style="text-align:left"><?php echo $p2;?></label>
            </div>
            <div class="item2">
                <label>Taken Date :</label><br/>
                <label style="text-align:left"><?php echo $p3;?></label>
            </div>
            <div class="item2">
                <label>Upload Date :</label><br/>
                <label style="text-align:left"><?php echo $p4;?></label>
            </div>
            <div class="item2">
                <label>Access :</label><br/>
                <label style="text-align:left"><?php if ($p5 == '0') {echo "Public";} else if ($p5 == '1') {echo "Active User";} else if ($p5 == '2') {echo "Follower";} else {echo "Private";};?></label>
            </div>
            <div class="item2">
                <label>Comment :</label><br/>
                <label style="text-align:left"><?php if ($p6 == 'Y') {echo "Enabled";} else if ($p6 == 'N') {echo "Disabled";};?></label>
            </div>
            <div class="item2">
                <label>Keywords :</label><br/>
                <label style="text-align:left"><?php echo $p7;?></label>
            </div>
            <div class="item2">
                <a href="<?php echo BASE_PATH;?>ephoto">
                    <button type="submit">Edit Photo Information</button>
            	</a>
            </div>
            <div class="item2" style="margin-top:10px">
            	<a href="<?php echo BASE_PATH;?>pdetail/delete/<?php echo $indexFoto;?>">
                	<button type="submit">Delete Photo</button>
                </a>
            </div>
        </div>
    	<div class="leftcontent" style="width:810px">
            <div style="margin-left:auto; margin-right:auto; width:500px">
            	<img src="<?php echo $pimg?>" alt="<?php echo $des?>" height="500" width="500" style="margin-top:10px; border-style:solid" />
                <br>
                <?php
                    global $session;

                    $photo_id = $indexFoto;
                    $sql_tag = "SELECT iduser FROM tag_foto WHERE idfoto='$photo_id'";
                    $result_tag = mysql_query($sql_tag);
                    while($res_tag = mysql_fetch_array($result_tag)){
                        $nama_tag = $res_tag['iduser'];
                        $sql_name = "SELECT fullname FROM user WHERE iduser='$nama_tag'";
                        $result_name = mysql_query($sql_name);
                        while($res = mysql_fetch_array($result_name)) {
                            $nama = $res['fullname'];
                        }
                ?>
                <strong>
                <a href="<?php echo BASE_PATH;?>pother/index/<?php echo $nama_tag?>">
                <?php
                    echo $nama;
                ?>
                </a>
                <br>
                </strong>
                <?php
                    }
                ?>
            </div>
            <div style="margin-top:5px; margin-left:auto; margin-right:auto; width:500px">
            	<button type="submit" name="plusbtn">Like</button>
                <button type="submit" name="plusbtn">Dislike</button>
            </div>
            
            <div class="wallpost">
                <form action="<?php echo BASE_PATH;?>pdetail/postkomen/<?php echo $indexFoto; ?>" method="post">
                    <?php
                        global $session;
                        $photo_id = $indexFoto;
                        $query_komen = "SELECT * FROM komen_foto WHERE idfoto='$photo_id'";
                        $result_komen = mysql_query($query_komen);
                        while($res_komen = mysql_fetch_array($result_komen)) {
                            $query2 = "SELECT * FROM user WHERE iduser='$res_komen[iduser]'";
                            $result2 = mysql_query($query2);
                            $res2 = mysql_fetch_array($result2);
                            echo '<div class="post">
                                    <div class="postitem" style="width: 65px">
                                        <div class="fotoitem">
                                            <img src="images/pudy.jpg" alt="pudy cantik" height="50" width="50" />
                                        </div>
                                    </div>
                                    <div class="postitem" style="width: 450px">
                                        <label>'.$res2['fullname'].'</label><br/>
                                        <label>'.$res_komen['isi'].'</label><br/>
                                    </div>
                                    <div class="postitem">
                                        <label>Delete</label>
                                    </div>
                                    <div class="clearboth"></div>
                                  </div>';
                        }
                    ?>
                    <div class="post">
                        <div class="post">
                            <textarea rows="2" cols="72" name="post"></textarea>
                        </div>
                        <div>
                            <button type="submit">Post</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="clearboth"></div>
    </div>
    <div class="footer"></div>
</div>
</body>
</html>
